﻿using System.Drawing;
using System.Drawing.Imaging;
using System.Management;
using System.Runtime.InteropServices;
using System.Security.Cryptography;
using System.Text;

namespace ConsoleApp1
{
    internal class IncAB
    {

        public static string b()
        {
            string str = (string)null;
            try
            {
                using (ManagementObjectSearcher managementObjectSearcher = new ManagementObjectSearcher((ObjectQuery)new SelectQuery(Unk.N())))
                {
                    foreach (ManagementBaseObject managementBaseObject in managementObjectSearcher.Get())
                    {
                        using (managementBaseObject)
                            str = managementBaseObject[Unk.n()].ToString();
                    }
                }
                if (str == null || str == Unk.O())
                 str = IncAB.C();
                return str;
            }
            catch (Exception ex)
            {
                RelIncAB.A(Unk.o() + ex.ToString());
                return Unk.P();
            }
        }

        public static string C()
        {
            try
            {
                string empty = string.Empty;
                foreach (ManagementObject instance in new ManagementClass(Unk.p()).GetInstances())
                {
                    if ((bool)instance[Unk.Q()])
                        empty = instance[Unk.q()].ToString();
                }
                return empty;
            }
            catch (Exception ex)
            {
                RelIncAB.A(Unk.R() + ex.ToString());
                return Unk.P();
            }
        }

        public static string a([In] string obj0)
        {
            using (MD5 md5 = MD5.Create())
            {
                byte[] bytes = Encoding.Default.GetBytes(obj0);
                byte[] hash = md5.ComputeHash(bytes);
                StringBuilder stringBuilder = new StringBuilder();
                for (int index = 0; index < hash.Length; ++index)
                    stringBuilder.Append(hash[index].ToString(Unk.r()));
                return stringBuilder.ToString().ToUpper();
            }
        }


        public static string A([In] string obj0)
        {
            try
            {
                Bitmap bitmap = new Bitmap(obj0);
                MemoryStream memoryStream = new MemoryStream();
                bitmap.Save((Stream)memoryStream, ImageFormat.Jpeg);
                byte[] numArray = new byte[memoryStream.Length];
                memoryStream.Position = 0L;
                memoryStream.Read(numArray, 0, (int)memoryStream.Length);
                memoryStream.Close();
                return Convert.ToBase64String(numArray);
            }
            catch (Exception ex)
            {
                RelIncAB.A(Unk.k() + ex.ToString());
            }
            return Unk.b();
        }

    }
}
